#pragma once
#ifndef useRealize1_h__
#define useRealize1_h__

#include "realize1.h"
#include "utility.h"

// g++ -o test -Wall -Wextra -ggdb -g3 -pthread test.cpp && gdb --args ./test
// valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes --verbose ./test
// procdump -accepteula -ma -e -f "" -x c:\ myexe.exe
int useRealize1() {
	std::cerr << getTime().c_str() << "Creating EventLoop" << std::endl;
	EventLoop<std::function<void()>>* eventloop = new EventLoop<std::function<void()>>(true);

	std::cerr << getTime().c_str() << "Adding event element" << std::endl;
	eventloop->enqueue(3000, [] { std::cerr << getTime().c_str() << "Running task 3" << std::endl; });
	eventloop->enqueue(1000, [] { std::cerr << getTime().c_str() << "Running task 1" << std::endl; });
	eventloop->enqueue(2000, [] { std::cerr << getTime().c_str() << "Running task 2" << std::endl; });

	std::this_thread::sleep_for(std::chrono::milliseconds(5000));
	delete eventloop;
	std::cerr << getTime().c_str() << "Exiting after 10 seconds..." << std::endl;
	return 0;
}
#endif // useRealize1_h__
